def task1(n):
    for i in range(n):
        print('正在搬第{}块砖！'.format(i))
        yield None


def task2(n):
    for i in range(n):
        print('正在听第{}首歌曲！'.format(i))
        yield None


g1 = task1(5)
g2 = task2(15)

print(g1)
print(g2)

i = 0

while True:
    i += 1
    if (i > 1000):
        break
    try:
        g1.__next__()
        g2.__next__()
    except Exception as err:
        print(err)
        break
